package com.action.addrbook;

import com.db.addrbook.*;
import java.util.*;
public class CategoryOutputAction{
	private int type;
	private int cno;
	private List<CategoryVO> calist;
	private CategoryVO cvo;	
	private CategoryDAO caDAO;
	
	public void setCaDAO(CategoryDAO caDAO) {
		this.caDAO = caDAO;
	}
	public void setType(int type) {
		this.type = type;
	}	
	public int getType() {
		return type;
	}
	public void setCno(int cno) {
		this.cno = cno;
	}
	public List<CategoryVO> getCalist() {
		return calist;
	}
	public CategoryVO getCvo() {
		return cvo;
	}
	
	public String getCaList(){
		String result = "";		
		try {
			if(type==0){
				//System.out.println("type0");
				calist = caDAO.getCategoryList();				
			}else{
				//System.out.println("type1");
				calist = caDAO.getCategoryList(type);
			}			
			result = "success";
			//System.out.println("coa"+calist.toString());
		} catch (Exception e) {
			result = "error";
			System.out.println("CategoryOutputAction.getCaList():"+e.toString());
		}
		return result;
	}
	
	public String getCaInfo(){
		String result = "";		
		try {
			cvo = caDAO.getCategoryInfo(cno);
			result = "success";
		} catch (Exception e) {
			result = "error";
			System.out.println("CategoryOutputAction.getCaInfo():"+e.toString());
		}
		return result;
	}	
}
